/* 项目流程 */
<template lang="html">
  <card :bordered="false">
    <p slot="title">
      <Row style="padding-bottom: 10px" :gutter="32">
        <Col span="2">
        <h4>项目流程单</h4>
        </Col>
        <Col span="2" style="color:#999" @click.native="toBack"> 返回>> </Col>
      </Row>
    </p>
    <p v-if="loading">正在加载中</p>
    <table v-else width="100%" cellpadding="0" cellspacing="0" border="1">
      <tr>
        <th colspan="4">项目流程单</th>
      </tr>
      <tr>
        <th>流程</th>
        <th>操作</th>
        <th>操作记录</th>
        <th>功能</th>
      </tr>
      <tr>
        <td rowspan="2" width="25%">创建项目</td>
        <td width="25%">保存</td>
        <td width="25%">{{info[0]['1a']}}</td>
        <td rowspan="2">
          <Button :disabled="isDisabled(0)" type="primary" size="small">打印</Button>
          <Button :disabled="isDisabled(0)" type="primary" size="small" @click="toShow('1')">查看</Button>
        </td>
      </tr>
      <tr>
        <td>提交</td>
        <td>{{info[0]['1b']}}</td>
      </tr>
      <tr>
        <td rowspan="2" width="25%">资料收集</td>
        <td width="25%">保存</td>
        <td width="25%">{{info[1]['1a']}}</td>
        <td rowspan="2">
          <Button :disabled="isDisabled(1)" type="primary" size="small">打印</Button>
          <Button :disabled="isDisabled(1)" type="primary" size="small" @click="toShow('2')">查看</Button>
        </td>
      </tr>
      <tr>
        <td>提交</td>
        <td>{{info[1]['1b']}}</td>
      </tr>
      <tr>
        <td rowspan="2" width="25%">现场勘探</td>
        <td width="25%">保存</td>
        <td width="25%">{{info[2]['1a']}}</td>
        <td rowspan="2">
          <Button :disabled="isDisabled(2)" type="primary" size="small">打印</Button>
          <Button :disabled="isDisabled(2)" type="primary" size="small" @click="toShow('3')">查看</Button>
        </td>
      </tr>
      <tr>
        <td>提交</td>
        <td>{{info[2]['1b']}}</td>
        <td></td>
      </tr>
      <tr>
        <td rowspan="2" width="25%">环境质量及监测</td>
        <td width="25%">保存</td>
        <td width="25%">{{info[3]['1a']}}</td>
        <td rowspan="2">
          <Button :disabled="isDisabled(3)" type="primary" size="small">打印</Button>
          <Button :disabled="isDisabled(3)" type="primary" size="small" @click="toShow('4')">查看</Button>
        </td>
      </tr>
      <tr>
        <td>提交</td>
        <td>{{info[3]['1b']}}</td>
        <td></td>
      </tr>
      <tr>
        <td rowspan="2" width="25%">报告编制及审核</td>
        <td width="25%">保存</td>
        <td width="25%">{{info[4]['1a']}}</td>
        <td rowspan="2">
          <Button :disabled="isDisabled(4)" type="primary" size="small">打印</Button>
          <Button :disabled="isDisabled(4)" type="primary" size="small" @click="toShow('5')">查看</Button>
        </td>
      </tr>
      <tr>
        <td>提交</td>
        <td>{{info[4]['1b']}}</td>
      </tr>
      <tr>
        <td rowspan="2" width="25%">报告送审</td>
        <td width="25%">保存</td>
        <td width="25%">{{info[5]['1a']}}</td>
        <td rowspan="2">
          <Button :disabled="isDisabled(5)" type="primary" size="small">打印</Button>
          <Button :disabled="isDisabled(5)" type="primary" size="small" @click="toShow('11')">查看</Button>
        </td>
      </tr>
      <tr>
        <td>提交</td>
        <td>{{info[5]['1b']}}</td>
      </tr>
      <tr>
        <td rowspan="2" width="25%">技术评估</td>
        <td width="25%">保存</td>
        <td width="25%">{{info[6]['1a']}}</td>
        <td rowspan="2">
          <Button :disabled="isDisabled(6)" type="primary" size="small">打印</Button>
          <Button :disabled="isDisabled(6)" type="primary" size="small" @click="toShow('12')">查看</Button>
        </td>
      </tr>
      <tr>
        <td>提交</td>
        <td>{{info[6]['1b']}}</td>
      </tr>
      <tr>
        <td rowspan="2" width="25%">报告报批</td>
        <td width="25%">保存</td>
        <td width="25%">{{info[7]['1a']}}</td>
        <td rowspan="2">
          <Button :disabled="isDisabled(7)" type="primary" size="small">打印</Button>
          <Button :disabled="isDisabled(7)" type="primary" size="small" @click="toShow('13')">查看</Button>
        </td>
      </tr>
      <tr>
        <td>提交</td>
        <td>{{info[7]['1b']}}</td>
      </tr>
      <tr>
        <td rowspan="2" width="25%">报告公示</td>
        <td width="25%">保存</td>
        <td width="25%">{{info[8]['1a']}}</td>
        <td rowspan="2">
          <Button :disabled="isDisabled(8)" type="primary" size="small">打印</Button>
          <Button :disabled="isDisabled(8)" type="primary" size="small" @click="toShow('14')">查看</Button>
        </td>
      </tr>
      <tr>
        <td>提交</td>
        <td>{{info[8]['1b']}}</td>
      </tr>
      <tr>
        <td rowspan="2" width="25%">报告存档</td>
        <td width="25%">保存</td>
        <td width="25%">{{info[9]['1a']}}</td>
        <td rowspan="2">
          <Button :disabled="isDisabled(9)" type="primary" size="small">打印</Button>
          <Button :disabled="isDisabled(9)" type="primary" size="small" @click="toShow('15')">查看</Button>
        </td>
      </tr>
      <tr>
        <td>提交</td>
        <td>{{info[9]['1b']}}</td>
      </tr>
    </table>
  </card>
</template>

<script>
import { getTypeInfo } from '../../libs/status'
export default {
  data() {
    return {
      info: {},
      loading: true,
    }
  },
  mounted() {
    // let project_id = this.$store.state.myProjectCheck.project_id
    let projectId = this.$route.query.ProjectId
    if (!projectId) {
      this.toBack()
    }

    localStorage.projectId = projectId
    this.getInfo(projectId)
  },
  methods: {
    getInfo(projectId) {
      console.log(projectId)
      axios.get('/audit/findSubmitTime', {
        // params: {
        //   project_id,
        // }
        ProjectId:projectId
      }).then((res) => {
        this.info = res.data
        this.loading = false
      })
    },
    toBack() {
      this.$router.push('/myproject/myProjectCheck')
    },
    isDisabled(number) {
      return !this.info[number]['1a']
    },
    toShow(status) {
      let name = getTypeInfo(status, 'route')
      this.$router.push({
        name,
      })
    },
  },
}
</script>

<style lang="css">
</style>
